def substitute_by_patterns(s: str, pats: list):
    if not s or not pats:
        return s

    for item in pats:
        s = item[0].sub(item[1], s)

    return s


def str_collection_lower(l: list):
    return [x.lower() if x else x for x in l]


def safe_lower(s: str):
    return s.lower() if s else s
